package cn.itsource.ymcc.client;

import cn.itsource.result.JSONResult;
import cn.itsource.ymcc.dto.MessageDto;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class MessageClientFallbackFactory implements FallbackFactory<MessageClient> {
    @Override
    public MessageClient create(Throwable throwable) {
        return new MessageClient() {
            @Override
            public JSONResult sendMsg(MessageDto messageDto) {
                throwable.printStackTrace();
                return JSONResult.error("公共服务消息推送 sendMsg 接口调用失败！"+throwable.getMessage());
            }
        };
    }
}
